<?php require_once('../Connections/elevate954.php'); ?>
<?php require_once("../webassist/file_manipulation/helperphp.php"); ?>
<?php require_once("../webassist/database_management/wa_appbuilder_php.php"); ?>
<?php require_once( "../webassist/security_assist/helper_php.php" ); ?>
<?php
if (!WA_Auth_RulePasses("Logged in to ADMIN_SETTINGS")){
	WA_Auth_RestrictAccess("../login_admin.php");
}
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
?>
<?php
$Parampages_id_WADApages = "-1";
if (isset($_GET['pages_id'])) {
  $Parampages_id_WADApages = $_GET['pages_id'];
}
mysql_select_db($database_elevate954, $elevate954);
$query_WADApages = sprintf("SELECT pages_id, PAGE_NAME, PAGE_CONTENT, MEDIA_TYPE, FILE_UPLOAD, PAGE_REDIRECT, PAGE_REDIRECT_URL, SEO_TITLE, SEO_DESCRIPTION, SEO_KEYWORDS FROM pages WHERE pages_id = %s", GetSQLValueString($Parampages_id_WADApages, "int"));
$WADApages = mysql_query($query_WADApages, $elevate954) or die(mysql_error());
$row_WADApages = mysql_fetch_assoc($WADApages);
$totalRows_WADApages = mysql_num_rows($WADApages);
?>
<?php
// WA_UploadResult1 Params Start
$WA_UploadResult1_Params = array();
// WA_UploadResult1_1 Start
$WA_UploadResult1_Params["WA_UploadResult1_1"] = array(
	'UploadFolder' => "../image_uploads/",
	'FileName' => "[FileName]",
	'DefaultFileName' => "".($row_WADApages["FILE_UPLOAD"])  ."",
	'ResizeType' => "2",
	'ResizeWidth' => "960",
	'ResizeHeight' => "0",
	'ResizeFillColor' => "" );
// WA_UploadResult1_1 End
// WA_UploadResult1 Params End
?>
<?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult1");
if(isset($_POST["Update"]) || isset($_POST["Update_x"])){
	WA_DFP_UploadFiles("WA_UploadResult1", "FILE_UPLOAD", "2", "[NewFileName]_[Increment]", "true", $WA_UploadResult1_Params);
}
?>
<?php 
// WA DataAssist Update
if (isset($_POST["Update"]) || isset($_POST["Update_x"])) // Trigger
{
  $WA_connection = $elevate954;
  $WA_table = "pages";
  $WA_redirectURL = "pages_results.php?pages_id=".((isset($_POST["WADAUpdateRecordID"]))?$_POST["WADAUpdateRecordID"]:"")  ."".(isset($_GET["pageNum_WADApages"])?"&pageNum_WADApages=".intval($_GET["pageNum_WADApages"]):"")  ."";
  if (function_exists("rel2abs")) $WA_redirectURL = $WA_redirectURL?rel2abs($WA_redirectURL,dirname(__FILE__)):"";
  $WA_keepQueryString = false;
  $WA_indexField = "pages_id";
  $WA_fieldNamesStr = "pages_id|PAGE_NAME|PAGE_CONTENT|MEDIA_TYPE|FILE_UPLOAD|SEO_TITLE|SEO_DESCRIPTION|SEO_KEYWORDS";
  $WA_fieldValuesStr = "".((isset($_POST["pages_id"]))?$_POST["pages_id"]:"")  ."" . $WA_AB_Split . "".((isset($_POST["PAGE_NAME"]))?$_POST["PAGE_NAME"]:"")  ."" . $WA_AB_Split . "".((isset($_POST["PAGE_CONTENT"]))?$_POST["PAGE_CONTENT"]:"")  ."" . $WA_AB_Split . "".((isset($_POST["MEDIA_TYPE"]))?$_POST["MEDIA_TYPE"]:"")  ."" . $WA_AB_Split . "".($WA_DFP_UploadStatus["WA_UploadResult1"]["serverFileName"])  ."" . $WA_AB_Split . "".((isset($_POST["SEO_TITLE"]))?$_POST["SEO_TITLE"]:"")  ."" . $WA_AB_Split . "".((isset($_POST["SEO_DESCRIPTION"]))?$_POST["SEO_DESCRIPTION"]:"")  ."" . $WA_AB_Split . "".((isset($_POST["SEO_KEYWORDS"]))?$_POST["SEO_KEYWORDS"]:"")  ."";
  $WA_columnTypesStr = "',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''";
  $WA_comparisonStr = " LIKE | LIKE | LIKE | LIKE | LIKE | LIKE | LIKE | LIKE  ";
  $WA_fieldNames = explode("|", $WA_fieldNamesStr);
  $WA_fieldValues = explode($WA_AB_Split, $WA_fieldValuesStr);
  $WA_columns = explode("|", $WA_columnTypesStr);
  
  $WA_where_fieldValuesStr = "".((isset($_POST["WADAUpdateRecordID"]))?$_POST["WADAUpdateRecordID"]:"")  ."";
  $WA_where_columnTypesStr = "',none,''";
  $WA_where_comparisonStr = "=";
  $WA_where_fieldNames = explode("|", $WA_indexField);
  $WA_where_fieldValues = explode($WA_AB_Split, $WA_where_fieldValuesStr);
  $WA_where_columns = explode("|", $WA_where_columnTypesStr);
  $WA_where_comparisons = explode("|", $WA_where_comparisonStr);
  
  $WA_connectionDB = $database_elevate954;
  mysql_select_db($WA_connectionDB, $WA_connection);
  @session_start();
  $updateParamsObj = WA_AB_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
  $WhereObj = WA_AB_generateWhereClause($WA_where_fieldNames, $WA_where_columns, $WA_where_fieldValues,  $WA_where_comparisons );
  $WA_Sql = "UPDATE `" . $WA_table . "` SET " . $updateParamsObj->WA_setValues . " WHERE " . $WhereObj->sqlWhereClause . "";
  $MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
  if ($WA_redirectURL != "")  {
    if ($WA_keepQueryString && $WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
      $WA_redirectURL .= ((strpos($WA_redirectURL, '?') === false)?"?":"&").$_SERVER["QUERY_STRING"];
    }
    header("Location: ".$WA_redirectURL);
  }
}
?>
<?php require_once("../webassist/ckeditor/ckeditor.php"); ?>
<!doctype html>
<html><!-- InstanceBegin template="/Templates/ADMIN BACKEND.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta charset="utf-8">
<!-- InstanceBeginEditable name="doctitle" -->
<title>Untitled Document</title>
<!-- InstanceEndEditable -->
<link rel="stylesheet" type="text/css" href="style/style.css" />
	<link rel="stylesheet" type="text/css" href="style/fluid.css" title="fluid" media="screen" />
        
	<title>Chameleon Circuit | Admin Panel from Themio</title>
        <script type="text/javascript" src="js/jquery-1.6.1.min.js"></script>
        <script type="text/javascript" src="js/jquery-ui-1.8.14.custom.min.js"></script>

        <script type="text/javascript" src="js/excanvas.min.js"></script>
        <script type="text/javascript" src="js/jquery.flot.min.js"></script>
        <script type="text/javascript" src="js/jquery.flot.pie.min.js"></script>
        <script type="text/javascript" src="js/jquery.flot.stack.min.js"></script>

        <script type="text/javascript" src="js/jquery.dataTables.min.js"></script>
        <script type="text/javascript" src="js/jquery.labelify.js"></script>
        <script type="text/javascript" src="js/iphone-style-checkboxes.js"></script>
        <script type="text/javascript" src="js/jquery.ui.selectmenu.js"></script>
        <script type="text/javascript" src="js/vanadium-min.js"></script>
        <script type="text/javascript" src="js/jquery.cleditor.min.js"></script>
        <script type="text/javascript" src="js/superfish.js"></script>
        <script type="text/javascript" src="js/jquery.colorbox-min.js"></script>
        <script type="text/javascript" src="js/styleswitch.js"></script>

        <script type="text/javascript" src="js/fullcalendar.min.js"></script>
        <script type="text/javascript" src="js/jquery.uploadify.v2.1.4.min.js"></script>
        <script type="text/javascript" src="js/uploadify.js"></script>
        <script type="text/javascript" src="js/jquery.tipsy.js"></script>

        <script type="text/javascript" src="js/gcal.js"></script>
        <script type="text/javascript" src="js/swfobject.js"></script>
        <script type="text/javascript" src="js/jquery.pnotify.min.js"></script>
        <script type="text/javascript" src="js/examples.js"></script>

        <script type="text/javascript" src="js/sidemenu.js">// Strictly for sidebar </script>

        <!-- Toolbar for Demo Only -->
        <link rel="stylesheet" type="text/css" href="demo/toolbar.css" />
        <link rel="stylesheet" media="screen" type="text/css" href="demo/colorpicker/css/colorpicker.css" />
        <style type="text/css">
        .bodyarea_admin {
	width: 100%;
	margin: 10px
}
        </style>
        <script type="text/javascript" src="demo/colorpicker/js/colorpicker.js"></script>
        <!-- Demo js Only -->
        <script type="text/javascript" src="js/demo.js"></script>
        <!-- InstanceBeginEditable name="head" -->


<script src="../webassist/progress_bar/jquery-blockui-formprocessing.js" type="text/javascript"></script>

<link href="../webassist/forms/fd_basic_default.css" rel="stylesheet" type="text/css">
<link href="../webassist/forms/dataassist_button.css" rel="stylesheet" type="text/css" />
<!-- InstanceEndEditable -->
</head>


<body>
<?php include("s_header.php"); ?>
    <div class="grid_16 widget first">
        <div class="widget_title clearfix">
            <h2>&nbsp;</h2>
        </div>
        <div class="widget_body">
          <div class="widget_content">
          </div>
            <div class="bodyarea_admin" id="bodyarea_admin"><!-- InstanceBeginEditable name="BODY_AREA" -->
<div id="Update_Basic_Default_ProgressWrapper">
<form enctype="multipart/form-data"  class="Basic_Default" id="Update_Basic_Default" name="Update_Basic_Default" method="post" action="<?php echo(htmlentities($_SERVER["PHP_SELF"], ENT_QUOTES)."?".$_SERVER["QUERY_STRING"]); ?>">
        <fieldset class="Basic_Default" id="Update">
          <legend class="groupHeader">Update</legend>
    <div class="lineGroup">
                          <div class="errorGroup">
     <span>
  <input id="pages_id" name="pages_id" type="hidden" value="<?php echo((isset($_GET["invalid"])?ValidatedField("pagesupdate","pages_id"):"".$row_WADApages["pages_id"]."")); ?>" class="formTextfield_Medium" tabindex="1">
	   </span>
                          </div>
    </div> 
    <div class="lineGroup"> <label for="PAGE_NAME" class="sublabel" > PAGE_NAME:</label>
                          <div class="errorGroup">
     <span>
  <input id="PAGE_NAME" name="PAGE_NAME" type="text" value="<?php echo((isset($_GET["invalid"])?ValidatedField("pagesupdate","PAGE_NAME"):"".$row_WADApages["PAGE_NAME"]."")); ?>" class="formTextfield_Medium" tabindex="2">
	   </span>
                          </div>
    </div> 
    <div class="lineGroup"> <label for="PAGE_CONTENT" class="sublabel" > PAGE_CONTENT:</label>
                          <div class="errorGroup">
     <span>
     <?php
// The initial value to be displayed in the editor.
$CKEditor_initialValue = "".((isset($_GET["invalid"])?ValidatedField("pagesupdate","PAGE_CONTENT",false):"".$row_WADApages["PAGE_CONTENT"].""))  ."";
$CKEditor = new CKEditor();
$CKEditor->basePath = "../webassist/ckeditor/";
$CKEditor_config = array();
$CKEditor_config["wa_preset_name"] = "File Manager Enabled";
$CKEditor_config["wa_preset_file"] = "FileManagerEnabled.xml";
$CKEditor_config["width"] = "98%";
$CKEditor_config["height"] = "450px";
$CKEditor_config["skin"] = "kama";
$CKEditor_config["dialog_startupFocusTab"] = false;
$CKEditor_config["fullPage"] = false;
$CKEditor_config["tabSpaces"] = 4;
$CKEditor_config["filebrowserBrowseUrl"] = "../webassist/kfm/index.php?uicolor=".urlencode(isset($CKEditor_config["uiColor"])?str_replace("#","#",$CKEditor_config["uiColor"]):"#eee")."&theme=webassist_v2&showsidebar=false";
$CKEditor_config["toolbar"] = array(
array( 'Source','-','Save','NewPage','Preview','-','Templates'),
array( 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Print','SpellChecker','Scayt'),
array( 'Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'),
array( 'Form','Checkbox','Radio','TextField','Textarea','Select','Button','ImageButton','HiddenField'),
array( 'BidiLtr','BidiRtl'),
('/'),
array( 'Bold','Italic','Underline','Strike','-','Subscript','Superscript'),
array( 'NumberedList','BulletedList','-','Outdent','Indent','Blockquote','CreateDiv'),
array( 'JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'),
array( 'Link','Unlink','Anchor'),
array( 'Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'),
('/'),
array( 'Styles','Format','Font','FontSize'),
array( 'TextColor','BGColor'),
array( 'Maximize','ShowBlocks','-','About'));
$CKEditor_config["contentsLangDirection"] = "ltr";
$CKEditor_config["entities"] = false;
$CKEditor_config["pasteFromWordRemoveFontStyles"] = false;
$CKEditor_config["pasteFromWordRemoveStyles"] = false;
$CKEditor->editor("PAGE_CONTENT", $CKEditor_initialValue, $CKEditor_config);
?>
     </span>
                          </div>
    </div> 
    <div class="lineGroup"> <label for="MEDIA_TYPE" class="sublabel" > MEDIA_TYPE:</label>
                          <div class="errorGroup">
     <span>
      <select class="formMenufield_Medium" name="MEDIA_TYPE" id="MEDIA_TYPE" tabindex="3">
        <option value="NONE" <?php if (!(strcmp("NONE", $row_WADApages['MEDIA_TYPE']))) {echo "selected=\"selected\"";} ?>>NONE</option>
        <option value="IMAGE" <?php if (!(strcmp("IMAGE", $row_WADApages['MEDIA_TYPE']))) {echo "selected=\"selected\"";} ?>>IMAGE</option>
       </select>
	   </span>
                          </div>
    </div> 
    <div class="lineGroup"> <label for="FILE_UPLOAD" class="sublabel" > FILE_UPLOAD:</label>
                          <div class="errorGroup">
     <span>
  <input name="FILE_UPLOAD" type="file" id="FILE_UPLOAD" size="30" tabindex="4">
	   </span>
                          </div>
    </div> 
    
    <div class="lineGroup"> <label for="SEO_TITLE" class="sublabel" > SEO_TITLE:</label>
                          <div class="errorGroup">
     <span>
  <input id="SEO_TITLE" name="SEO_TITLE" type="text" value="<?php echo((isset($_GET["invalid"])?ValidatedField("pagesupdate","SEO_TITLE"):"".$row_WADApages["SEO_TITLE"]."")); ?>" class="formTextfield_Medium" tabindex="7">
	   </span>
                          </div>
    </div> 
    <div class="lineGroup"> <label for="SEO_DESCRIPTION" class="sublabel" > SEO_DESCRIPTION:</label>
                          <div class="errorGroup">
     <span>
  <input id="SEO_DESCRIPTION" name="SEO_DESCRIPTION" type="text" value="<?php echo((isset($_GET["invalid"])?ValidatedField("pagesupdate","SEO_DESCRIPTION"):"".$row_WADApages["SEO_DESCRIPTION"]."")); ?>" class="formTextfield_Medium" tabindex="8">
	   </span>
                          </div>
    </div> 
    <div class="lineGroup"> <label for="SEO_KEYWORDS" class="sublabel" > SEO_KEYWORDS:</label>
                          <div class="errorGroup">
     <span>
  <input id="SEO_KEYWORDS" name="SEO_KEYWORDS" type="text" value="<?php echo((isset($_GET["invalid"])?ValidatedField("pagesupdate","SEO_KEYWORDS"):"".$row_WADApages["SEO_KEYWORDS"]."")); ?>" class="formTextfield_Medium" tabindex="9">
	   </span>
                          </div>
    </div> 
        <span class="buttonFieldGroup" >
          <input type="submit" value="Update" class="formButton" id="Update" name="Update" />
        </span>
        </fieldset>
<input type="hidden" name="WADAUpdateRecordID" id="WADAUpdateRecordID" value="<?php echo((isset($_GET["invalid"])?ValidatedField("pagesupdate","WADAUpdateRecordID"):$_GET["pages_id"])); ?>" />
</form></div><div id="Update_Basic_Default_ProgressMessageWrapper" class="blockUIOverlay" style="display:none;">
<script type="text/javascript">
WADFP_SetProgressToForm('Update_Basic_Default', 'Update_Basic_Default_ProgressMessageWrapper', WADFP_Theme_Options['BigSpin:Slate']);
</script>
<div id="Update_Basic_Default_ProgressMessage" >
	<p style="margin:10px; padding:5px;" ><img src="../webassist/progress_bar/images/slate-largespin.gif" alt="" title="" style="vertical-align:middle;" />&nbsp;&nbsp;Please wait</p>
</div>
</div>

<!-- InstanceEndEditable --></div>
        </div>
        </div>
    </div>
    <!--
<div id="dialog" title="Hello, Hello, Twisted Transistor">
	<p>Chameleon Circuit features unlimited color schemes. Try moving the color sliders on the top right corner of your screen and see how you would like YOUR theme to be!</p>
</div>
-->
<?php include("footer.php") ?>
</body>
<!-- InstanceEnd --></html>
<?php
mysql_free_result($WADApages);
?>
